package encode;

import java.io.UnsupportedEncodingException;

/**
 * Created by User on 2018/1/12.
 */
public class App {

    public static void main(String[] args) throws UnsupportedEncodingException {
        String str = null;
        str = "中";
        System.out.println(str.getBytes("GBK").length);     // 2
        System.out.println(str.getBytes("UTF-8").length);   // 3
        System.out.println(str.getBytes("UNICODE").length); // 4
        System.out.println(str.getBytes("UTF-16").length);  // 4

        str = "b";
        System.out.println(str.getBytes("GBK").length);     // 1
        System.out.println(str.getBytes("UTF-8").length);   // 1
        System.out.println(str.getBytes("UNICODE").length); // 4
        System.out.println(str.getBytes("UTF-16").length);  // 4

        System.out.println(0xD800 + "-" + 0xDBFF);
        System.out.println(0xDC00 + "-" + 0xDFFF);

        // Character.codePointAt();
    }


}
